"""
This file is part of GSBEdit. For copyright and licensing information, please
see gsbedit.py in the GSBEdit base directory.
"""


import wx


class TextCtrlBorder(wx.Panel):
    def __init__(self, parent, item_id, style=0, size=(-1, -1), background_colour=wx.NullColor):
        wx.Panel.__init__(self, parent)
        
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.textctrl = wx.TextCtrl(self, item_id, style=style, size=size)
        sizer.Add(self.textctrl, 1, wx.EXPAND | wx.ALL, border=2)
        
        self.SetSizer(sizer)
        
        self.SetBackgroundColour(background_colour)


    def SetValue(self, value):
        self.textctrl.SetValue(value)
    
    
    def reset_value(self):
        self.textctrl.SetValue('')
    
    
    def set_control_background(self, colour):
        self.textctrl.SetBackgroundColour(colour)
        
        
    def GetValue(self):
        return self.textctrl.GetValue()
    
    
    def SetToolTipString(self, string):
        wx.Panel.SetToolTipString(self, string)
        self.textctrl.SetToolTipString(string)
